package com.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * ConstructorTest--bdqnPractice
 *
 * @author: Jovi
 * @createTime: 2017-08-02 10:53
 **/
public class ConstructorTest {
    public static void main(String[] args) {
        Class cls = People.class;
        Class[] clses = {String.class,int.class};

        try {
            Constructor cons = cls.getConstructor(clses);
            Object [] objs = {"姓名",23};
            Object o = cons.newInstance(objs);
            System.out.println(o);
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

    }
}
